import 'package:ducafe_ui_core/ducafe_ui_core.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';

void showReportBottomSheet(BuildContext context) {
  showModalBottomSheet(
    context: context,
    backgroundColor: Colors.transparent,
    isScrollControlled: true,
    useSafeArea: true,
    useRootNavigator: true,
    routeSettings: RouteSettings(name: '/report'),
    builder:
        (context) => Container(
          padding: EdgeInsets.only(top: 22.h, bottom: 32.h),
          decoration: BoxDecoration(
            gradient: LinearGradient(
              begin: Alignment.topLeft,
              end: Alignment.bottomRight,
              colors: [
                const Color(0xFFB197FC), // 紫色
                const Color(0xFFFFF1FB), // 白粉色
              ],
            ),
            borderRadius: BorderRadius.only(
              topLeft: Radius.circular(24.r),
              topRight: Radius.circular(24.r),
            ),
            boxShadow: [
              BoxShadow(
                color: Colors.black.withOpacity(0.15),
                blurRadius: 10,
                offset: Offset(0, -2),
              ),
            ],
          ),
          child: Column(
            mainAxisSize: MainAxisSize.min,
            children: [
              // 标题
              Padding(
                padding: EdgeInsets.only(bottom: 20.h),
                child: Text(
                  'Report Content',
                  style: TextStyle(
                    fontSize: 20.sp,
                    color: Colors.black87,
                    fontWeight: FontWeight.w600,
                    fontFamily: 'Inter',
                  ),
                ),
              ),

              // 描述文字
              Padding(
                padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 8.h),
                child: Text(
                  'Tell us why you want to report this content',
                  style: TextStyle(
                    fontSize: 15.sp,
                    color: Colors.black54,
                    fontFamily: 'Inter',
                  ),
                  textAlign: TextAlign.center,
                ),
              ),

              SizedBox(height: 10.h),

              // 选项列表
              _buildOption(context, 'Pornographic vulgarity'),
              _buildOption(context, 'Hate speech'),
              _buildOption(context, 'Nauseating'),
              _buildOption(context, 'Illegal'),
              _buildOption(context, 'Other'),

              SizedBox(height: 20.h),

              // 取消按钮
              GestureDetector(
                onTap: () => Navigator.pop(context),
                child: Container(
                  width: 150.w,
                  height: 44.h,
                  decoration: BoxDecoration(
                    color: Colors.white.withOpacity(0.3),
                    borderRadius: BorderRadius.circular(22.r),
                    border: Border.all(color: Colors.white.withOpacity(0.5)),
                  ),
                  alignment: Alignment.center,
                  child: Text(
                    'Cancel',
                    style: TextStyle(
                      color: Colors.black87,
                      fontSize: 16.sp,
                      fontWeight: FontWeight.w500,
                      fontFamily: 'Inter',
                    ),
                  ),
                ),
              ),
            ],
          ),
        ),
  );
}

// 构建单个选项
Widget _buildOption(BuildContext context, String title) {
  return Container(
    width: double.infinity,
    margin: EdgeInsets.symmetric(horizontal: 24.w, vertical: 6.h),
    decoration: BoxDecoration(
      color: Colors.white.withOpacity(0.7),
      borderRadius: BorderRadius.circular(12.r),
      boxShadow: [
        BoxShadow(
          color: Colors.black.withOpacity(0.05),
          blurRadius: 4,
          offset: Offset(0, 2),
        ),
      ],
    ),
    child: Material(
      color: Colors.transparent,
      child: InkWell(
        borderRadius: BorderRadius.circular(12.r),
        onTap: () {
          Navigator.pop(context);
          // 处理选择逻辑
          if (title != 'Cancel') {
            print('用户选择了: $title');
            // 使用 EasyLoading 显示美观的成功提示
            EasyLoading.showSuccess('Report submitted');
          }
        },
        child: Padding(
          padding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 20.w),
          child: Text(
            title,
            style: TextStyle(
              color: Colors.black87,
              fontSize: 16.sp,
              fontWeight: FontWeight.w500,
              fontFamily: 'Inter',
            ),
          ),
        ),
      ),
    ),
  );
}
